package backend;

import java.util.Vector;

import backend.instructions.Instruction;

public class ProgramCode {

	Vector<Instruction> instructions;
	boolean finished;

	public ProgramCode() {
		instructions = new Vector<Instruction>(10, 5);
		finished = false;
	}

	public void setFinished() {
		instructions.trimToSize();
		finished = true;
	}

	public void addInstruction(Instruction inst) {
		if (!finished)
			instructions.add(inst);
	}

	public Instruction getInstruction(int i) {
		if (!finished) {
			if (i >= 0 && i < instructions.size())
				return instructions.get(i);
		}
		return null;

	}
}
